﻿@model Telerik.Web.Mvc.GridModel<Loja.Models.ClienteModels>
@using Telerik.Web.Mvc.UI
@{
    int gridPageSize = 10;
}
    <table>
    <tr>
        <td>
            @(Html.Telerik().Grid<Loja.Models.ClienteModels>(Model.Data)
                    .Name("Produtos")
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.IdCliente)
                            .Width("100px")
                            .Template(x => x.IdCliente.ToString().ToLower());

                        columns.Bound(x => x.Nome)
                            .Width("100px");
                        
                        columns.Bound(x => x.Celular)
                           .Width("100px");

                        columns.Bound(x => x.Telefone)
                           .Width("100px");
                        columns.Bound(x => x.Telefone)
                            .Width(50)
                            .Template(x => Ajax.ActionLink("Editar", "Editar", new { idCliente = x.IdCliente }, new AjaxOptions { UpdateTargetId = "Conteudo", HttpMethod = "get", InsertionMode = InsertionMode.Replace, OnSuccess="" }))
                            .ClientTemplate("<a href=\"Editar/<#= Id #>\">" + "Editar" + "</a>");
                    })
                    .Pageable(settings => settings.Total(Model.Total).PageSize(gridPageSize).Position(GridPagerPosition.Both))
                            .DataBinding(dataBinding => dataBinding.Ajax().Select("GetListaCliente", "Consumer"))
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>
